import request from '@/utils/request'

// 查询客户地址管理列表
export function listAddr(query) {
  return request({
    url: '/system/addr/list',
    method: 'get',
    params: query
  })
}

// 查询客户地址管理详细
export function getAddr(addressId) {
  return request({
    url: '/system/addr/' + addressId,
    method: 'get'
  })
}

export function getCustomer(customerId) {
    return request({
        url: '/system/addr/addr/' + customerId,
        method: 'get'
    })
}

export function getCustomerAddr(customerId, addressId) {
  return request({
    url: '/system/addr/getByCustomerIdAndAddressId',
    method: 'get',
    params: { customerId, addressId }
  })
}

// 新增客户地址管理
export function addAddr(data) {
  return request({
    url: '/system/addr',
    method: 'post',
    data: data
  })
}

// 修改客户地址管理
export function updateAddr(data) {
  return request({
    url: '/system/addr',
    method: 'put',
    data: data
  })
}

// 删除客户地址管理
export function delAddr(addressId) {
  return request({
    url: '/system/addr/' + addressId,
    method: 'delete'
  })
}

export function delCustomerAddr(customerAddr) {
  return request({
    url: '/system/addr/delete', // 根据实际情况调整 URL
    method: 'delete',
    data: customerAddr
  })
}
